﻿namespace RankDemo.WebApi.Extensions
{
    public class EntityNotFoundException : Exception
    {
        public Type EntityType { get; set; }

        public object Id { get; set; }

        public EntityNotFoundException(Type entityType, object id)
            : base(id == null ?
                  $"There is no such an entity given id. Entity type: {entityType.FullName}"
                : $"There is no such an entity. Entity type: {entityType.FullName}, id: {id}")
        {
            EntityType = entityType;
            Id = id;
        }
    }
}
